import { 
    CHANGE_SHOW_WEEK, 
    CHANGE_CUR_WEEK
} from '../actions/courses';

const initCourses = {
    showWeek:1,
    currentWeek:1,
    totalWeeks:24,
    firstDay:'2018-03-05', //严格按照年月日的格式
}

export default coursesReducer = (state = initCourses, action) => {
    switch (action.type) {
        case CHANGE_SHOW_WEEK:
            state = {
                ...state,
                showWeek:action.payload
            }
            break;
        case CHANGE_CUR_WEEK:
            state = {
                ...state,
                currentWeek:action.payload
            }
            break;
    }
    return state;
}